//
//  TXJLCell.m
//  FruitsWholesaler
//
//  Created by sgone-2 on 15/12/4.
//  Copyright © 2015年 sgone. All rights reserved.
//

#import "TXJLCell.h"
#import "Common.h"

@implementation TXJLCell

- (void)awakeFromNib {


    
    
    
    self.labelMS = [[UILabel alloc]initWithFrame:CGRectMake(ViewWidth*0.8, 0, 95, 30)];
    [self.contentView addSubview:self.labelMS];
    self.labelMS.font = [UIFont systemFontOfSize:13];
    self.labelMS.textColor = [UIColor grayColor];
   
    
    
    //时间
    self.labelTime = [[UILabel alloc]initWithFrame:CGRectMake(175, 0,65 , 30)];
    [self.contentView addSubview:self.labelTime];
    self.labelTime.font  = [UIFont systemFontOfSize:13];
    self.labelTime.textColor = [UIColor grayColor];
    self.labelTime.textAlignment = NSTextAlignmentCenter;
    
    
    
    //金额
    self.labelJE = [[UILabel alloc]initWithFrame:CGRectMake(ViewWidth*0.8, 0, ViewWidth *0.2, 30)];
    [self.contentView addSubview:self.labelJE];
    self.labelJE.font  = [UIFont systemFontOfSize:13];
    self.labelJE.textColor = [UIColor grayColor];
    
//    self.labelJE.textAlignment = NSTextAlignmentCenter;
    
    
    
}



-(void)loadCell:(NSDictionary *)dic
{

//    NSLog(@"所有的数据  %@",dic);
    
//    if(type==1){
//        holder.caseTv.setText("收入");
//        holder.desTv.setText("订单号\n"+transBean.getCode());
//				}else if(type==2){
//                    if(status==1){
//                        holder.caseTv.setText("申请");
//                    }else if(status==2){
//                        holder.caseTv.setText("已支付");
//                    }else if(status==3){
//                        holder.caseTv.setText("转账中");
//                    }else if(status==4){
//                        holder.caseTv.setText("审核失败");
//                    }else if(status==5){
//                        holder.caseTv.setText("转账失败");
//                    }else if(status==6){
//                        holder.caseTv.setText("通过审核");
//                    }
    
    id shijian = [dic objectForKey:@"type"];
    id shijian2 = [dic objectForKey:@"status"];
    self.labelSJ.font = [UIFont systemFontOfSize:14];
    if ([shijian intValue] == 1) {
        self.labelSJ.text = @"收入";
//        self.labelSJ.textColor = FDUSERNAME_COLOR;
   
        
    }
    else if ([shijian intValue] == 2)
    {
        
//        self.labelSJ.textColor = BenSe_COLOR
        if ([shijian2 intValue] == 1) {
            self.labelSJ.text = @"申请中";
            
            
        }
        else if ([shijian2 intValue] ==2)
        {
        
//            self.labelSJ.text = @"已支付";
            self.labelSJ.text  = @"已完成";
        
        
        }else if ([shijian2 intValue] == 3)
        {
        
//        self.labelSJ.text = @"转账中";
            self.labelSJ.text = @"申请中";
        
        
        }
        else if ([shijian2 intValue] == 4)
        {
//        self.labelSJ.text = @"审核失败";
            
            self.labelSJ.text = @"申请中";
        
        }
        else if ([shijian2 intValue] == 5)
        {
        
//            self.labelSJ.text = @"转账失败";
            self.labelSJ.text = @"申请失败";
        
        }
        else if ([shijian2 intValue] == 6)
        {
        
//            self.labelSJ.text = @"审核通过";
            self.labelSJ.text = @"申请中";
        
        }
        else
        {
        
        
        
        }
        
    }
    
    
    
        //label自适应
    //    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,0,0)];这个frame是初设的，没关系，后面还会重新设置其size。
    //
    //    [label setNumberOfLines:0];
    //
    //    NSString *s = @"string......";
    //
    //    UIFont *font = [UIFont fontWithName:@"Arial" size:12];
    //
    //    CGSize size = CGSizeMake(320,2000);
    //
    //    CGSize labelsize = [s sizeWithFont:font constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
    //
    //    [label setFrame:CGRectMake:(0,0, labelsize.width, labelsize.height)];
    //
    //    [self.view addSubView:label];
    //    
    //    这样就可以对s赋值让其自动调整其大小了。其实宽度可以设置为固定，让其改高度更好。
    
 
    
    
    
    
    //时间
    [self.labelTime setNumberOfLines:0];
    self.labelTime.text = [NSString stringWithFormat:@"   %@",[dic objectForKey:@"create_datetime"]];
    CGSize size2 = CGSizeMake(70, 70);
    CGSize labelTimeSize = [self.labelTime.text sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:size2 lineBreakMode:UILineBreakModeCharacterWrap];
    [self.labelTime setFrame:CGRectMake(10, 10, labelTimeSize.width, labelTimeSize.height)];
    
    
    //金额
    [self.labelJE setNumberOfLines:0];
    self.labelJE.text =  [NSString stringWithFormat:@"%@",[dic objectForKey:@"amount"]];
    
    
    
    if ([shijian intValue] == 1) {
        
        self.labelJE.textColor = FDUSERNAME_COLOR;
        self.labelJE.text =  [NSString stringWithFormat:@"+%@",[dic objectForKey:@"amount"]];
          self.labelMS.text = @"订单";
        
    }
    else if ([shijian intValue] == 2)
    {
        
        self.labelJE.textColor = BenSe_COLOR;
        self.labelJE.text = [NSString stringWithFormat:@"-%@",[dic objectForKey:@"amount"]];
           self.labelMS.text = @"提现";
        
    }
    
    
    [self.labelMS setNumberOfLines:0];
    //    self.labelMS.text =[NSString stringWithFormat:@"提现卡号%@",[dic objectForKey:@"code"]];
  
    CGSize size = CGSizeMake(95, 68);
    CGSize labelMSSize2 = [self.labelMS.text sizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
    self.labelMS.textAlignment = NSTextAlignmentLeft;
    [self.labelMS setFrame:CGRectMake(ViewWidth *0.3, 30, labelMSSize2.width , labelMSSize2.height)];
    

      CGSize size3 = CGSizeMake(100, 70);
    
     CGSize labelJESize = [self.labelJE.text sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:size3 lineBreakMode:UILineBreakModeCharacterWrap];
    [self.labelJE setFrame:CGRectMake(ViewWidth *0.50, 30, labelJESize.width, labelJESize.height)];

    


}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

@end
